import SourceView from "./source_view";
import { SelectionModel, TextModel } from "../../models"

// import md2html from '../markdown_parse'
export class SourceAndPreviewView extends SourceView {
    previewElement_; // 双屏右侧的显示元素
    // private textModel_;
    // private selectionModel_;
    // private viewContainer_: any;
    constructor(textModel: TextModel, selectionModel: SelectionModel, viewContainer: any) {
        super(textModel, selectionModel, viewContainer)
        this.textModel_ = textModel
        this.selectionModel_ = selectionModel
        const previewElement = document.createElement('pre')
        previewElement.setAttribute('class', 'container-pre preview')
        this.viewContainer_.parentElement.appendChild(previewElement)
        this.previewElement_ = previewElement
    }
    render() {
        this.viewContainer_.innerHTML = this.textModel_.getSpacers() + '\n'
        setTimeout(() => {
            this.updateDomSelection()
        }, 0)
        //     // this.previewElement_.innerHTML = md2html(this.textModel_.getSpacers())
    }
}
export default SourceAndPreviewView